function initPersonal() {
    //显示公告关键词
    $('.notify_keyword').click(function () {
        $('.notify_keyword').hide();
        $('.keyword').show();
    })

    //查看公告的上、下篇
    $('.view').click(function () {
        var url = $(this).attr('data-url');
        $.get(url, function (res) {
            console.log(res);
            if (res.status == 0) {
                layer.msg(res.info);
            } else {
                location.href = res.url;
            }
        })
    })

    //查询
    $('.search').click(function () {
        var month = $('.timeList .active').text();
        var dept_id = $('.dept .active').attr('data-id');
        if (month) {
            var pos = month.indexOf('月');
            var val = month.substring(0, pos);
            if (val < 10) {
                val = '0' + val;
            }
            var html = '<input type="hidden" name="month" value="' + val + '">';
            $('.timeList').after(html);
        }
        if (dept_id) {
            var html = '<input type="hidden" name="dept_id" value="' + dept_id + '">';
            $('.dept').after(html);
        }
        $('form').submit();
    })

    //显示新闻关键词
    $('.news_keyword').click(function () {
        $('.news_keyword').hide();
        $('.keyword').show();
    })

    //发表新闻评论
    $(document).one('click', '.comment', function () {
        var news_id = $('#news_id').val();
        var content = $('#CONTENT').val();
        var url = 'commentNews/news_id/' + news_id + '/content/' + content;
        $.get(url, function (res) {
            console.log(res);
            if (res.status == 0) {
                layer.msg(res.info);
            } else {
                location.href = res.url;
            }
        })
    })

    //删除新闻评论
    $('.delComment').click(function () {
        var url = $(this).attr('data-url');
        layer.confirm('确定要进行此操作吗？', {
            closeBtn: 0,
            btn: ['确定', '取消'] //按钮
        }, function () {
            var index = layer.load(1, {shade: false});
            $.get(url, function (res) {
                console.log(res);
                layer.msg(res.info);
                location.reload();
            })
        }, function (index) {
            layer.close(index);
        });
    })

    //回复新闻评论
    $(document).one('click', '.replyComment', function () {
        var news_id = $('#news_id').val();
        var comment_id = $(this).attr('data-id');
        var document_w = $(window).width();
        var document_h = $(window).height();
        var layer_w = '550';
        var layer_h = '350';
        var w = (document_w - layer_w) / 2;
        var h = (document_h - layer_h) / 2;
        layer.open({
            type: 2,
            title: [
                "发表新闻评论",
                'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
            ],
            area: [layer_w + 'px', layer_h + 'px'], //宽高
            offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
            content: "/index.php/Home/Index/layer/type/12/news_id/" + news_id + "/comment_id/" + comment_id
        })
    })

    //删除工作日志
    $('.delDiary').click(function () {
        var url = $(this).attr('data-url');
        layer.confirm('确定要进行此操作吗？', {
            closeBtn: 0,
            btn: ['确定', '取消'] //按钮
        }, function () {
            var index = layer.load(1, {shade: false});
            $.get(url, function (res) {
                console.log(res)
                if (res.status)
                    location.reload();
                else
                    layer.msg('删除失败');
            })
        }, function (index) {
            layer.close(index);
        });
    })

    //评论日志
    $('body').one('click', '.comment_diary', function () {
        var dia_id = $(this).attr('data-id');
        var comment_id = $(this).attr('data-id');
        var document_w = $(window).width();
        var document_h = $(window).height();
        var layer_w = '550';
        var layer_h = '350';
        var w = (document_w - layer_w) / 2;
        var h = (document_h - layer_h) / 2;
        layer.open({
            type: 2,
            title: [
                "发表评论",
                'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
            ],
            area: [layer_w + 'px', layer_h + 'px'], //宽高
            offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
            content: "/index.php/Home/Index/layer/type/4/dia_id/" + dia_id
        })
    })

    //回复日志评论
    $('body').one('click', '.replyCommentDiary', function () {
        var dia_id = $(this).attr('data-dia-id');
        var comment_id = $(this).attr('data-cmt-id');
        var comment_id = $(this).attr('data-id');
        var document_w = $(window).width();
        var document_h = $(window).height();
        var layer_w = '550';
        var layer_h = '350';
        var w = (document_w - layer_w) / 2;
        var h = (document_h - layer_h) / 2;
        layer.open({
            type: 2,
            title: [
                "回复评论",
                'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
            ],
            area: [layer_w + 'px', layer_h + 'px'], //宽高
            offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
            content: "/index.php/Home/Index/layer/type/6/dia_id/" + dia_id + "/comment_id/" + comment_id
        })
    })

    //删除日志评论
    $('.delReply').click(function () {
        var type = $(this).attr('data-cmt-type');
        var url = $(this).attr('data-url');
        layer.confirm('确定要进行此操作吗？', {
            closeBtn: 0,
            btn: ['确定', '取消'] //按钮
        }, function () {
            var index = layer.load(1, {shade: false});
            $.get(url, {type: type}, function (res) {
                console.log(res)
                if (res.status)
                    location.reload();
                else
                    layer.msg('删除失败');
            })
        }, function (index) {
            layer.close(index);
        });

    })

    //日志检索
    $('.deptName').click(function () {
        //获取当前对象的兄弟节点的子节点
        var str = $(this).parent().siblings().children();
        for (var i = 0; i < str.length; i++) {
            //当已有展开的用户时，再点击其他部门的时候自动将之前的展示去掉
            if (i % 2 != 0) {
                if (str[i].style.display == 'block') {
                    str[i].style.display = 'none';
                }
            }
        }

        if ($(this).siblings().css('display') == 'none') {
            $(this).siblings().css('display', 'block');
        } else if ($(this).siblings().css('display') == 'block') {
            $(this).siblings().css('display', 'none');
        }
    })

    //切换用户查看工作日志
    $('.user').click(function () {
        var para = $(this).parent().parent().siblings().children().children();
        for (var i = 0; i < para.length; i++) {
            if (i % 2 != 0) {
                $(para[i]).removeClass('cur_user');
            }
        }
        $(this).addClass('cur_user');
        var user_id = $(this).attr('data-id');
        var user_name = $(this).attr('data-user-name');
        var is_view = $('#is_view').val();
        $.ajax({
            url: 'searchDiary',
            data: {is_view: is_view, user_id: user_id, user_name: user_name},
            type: 'get',
            success: function (res) {
                console.log(res);
                if (res.status > 0) {
                    var html_top = '<font style="font-size:15px;font-weight:bolder;float:left;">' + res.user_name + ' - 最新日志</font>';
                    html_top += '<span style="float:left;margin-left:20%;">共<font style="color:red;">' + res.count + '</font>条数据</span>';
//                    html_top += '<span class="larry-table-page clearfix" style="float:right;margin-bottom:10px;"><input type="hidden" id="followUrl" value="searchDiary"><span id="page" class="page">';
//                    html_top += res.page;
                    $('.diary_top').html(html_top);
                    //插入页码
                    var page = '<div>';
                    page += '<a class="pointer prev" onclick="getData(' + res.prev + ')" style="width:30px"><<</a>';
                    for (var i = 0; i < res.page.length; i++) {
                        if (res.curr == res.page[i]) {
                            page += '<span class="current">' + res.page[i] + '</span>'
                        } else {
                            page += '<a class="pointer num" onclick="getData(' + res.page[i] + ')">' + res.page[i] + '</a>';
                        }
                    }
                    page += '<a class="pointer next" onclick="getData(' + res.next + ')" style="width:30px">>></a>';
                    page += '</div>';
                    $('.page').html(page);

                    $('.page').html(res.page)

                    var html = '';
                    for (var i = 0; i < res.data.length; i++) {
                        //标题
                        html += '<table class="TableTop" width="100%"><tbody>';
                        html += '<tr><td class="left"></td><td class="subject">';
                        html += '<a>' + res.data[i].subject + '</a>';
                        html += '</td><td class="subject" align="right"><div class="operate">&nbsp;&nbsp;';
                        html += '</div></td><td class="right"></td></tr></tbody></table>';

                        //内容
                        html += '<div class="one_diary">';
                        html += '<div class="diary_type">工作日志 | 日志日期：' + res.data[i].dia_date + ' 星期三</div>';
                        html += '<div class="content" style="overflow-y:auto;overflow-x:auto;width=100%;height=100%">';
                        html += '<p>' + res.data[i].content + '</p></div>';
                        if (res.data[i].comment) {
                            html += '<div style="border-top:1px solid $eee;padding:10px"><p>点评：</p><ul class="feed-exit-list">';
                            for (var j = 0; j < res.data[i].comment.length; j++) {
                                html += '<li class="feed-cmt-list-item" style="padding:5px">';
                                html += '<b>' + res.data[i].comment[j].user_id + '</b><span style="display:inline-block;margin-left:20px">' + res.data[i].comment[j].send_time + '</span>';
                                html += '<p>' + res.data[i].comment[j].content + '</p>';
                                html += '</li>';
                            }
                            html += '</ul></div>';
                        }
                        html += '</div>';
                    }
                    $('.diary_content').html(html);
                } else {
                    var noHtml = '<table style="width:500px;margin:10% auto;border:1px solid #83ACCF;" cellspacing="0" cellpadding="0" align="center"><tbody>';
                    noHtml += '<tr class="head"><td class="left" style="background:#EBBF47;"></td><td class="center" style="background:#EBBF47;font-size:16px;font-weight:bolder;"><div class="title">提示</div></td><td class="right"></td></tr>';
                    noHtml += '<tr class="msg"><td class="left" style="height:90px;background-color: #FFF;"></td>';
                    noHtml += '<td class="center info" style="height:90px;background-color: #FFF;background: url(\'/Public/Admin/images/icon64_info.png\');background-position: 10px 10px;background-repeat: no-repeat;">';
                    noHtml += '<div class="msg-content" style="font-size: 16px;color: #EBBF47;">该用户暂无日志</div></td><td class="right" style="height:90px;background-color: #fff;"></td></tr>';
                    noHtml += '<tr class="foot"><td class="left"></td><td class="center"><b></b></td><td class="right"></td></tr></tbody></table>';
                    $('.diary_top').html('');
                    $('.page').html('');
                    $('.diary_content').html(noHtml);
                }
            }
        })
    })

    //个人设置
    $('.top').click(function () {
        var str = $(this).attr('class');
        var param = $(this).attr('data-type');
        if (str.indexOf('on') == -1) {
            $(this).siblings().removeClass('on')
            $(this).addClass('on');
        }
        if (param == 'info') {
            $('.account').hide();
            $('.info').show();
        } else if (param == 'account') {
            $('.info').hide();
            $('.account').show();
        }
        return;
    })

    //修改个人信息
    $('body').one('click', '.submitInfo', function () {
        var url = $(this).attr('data-url');
        var data = $('#form1').serialize();
        $.ajax({
            url: url,
            data: data,
            type: 'post',
            success: function (res) {
                layer.msg(res.info);

            }
        })
    })

    //修改OA密码
    $('body').one('click', '.submitAccount', function () {
        var pass0 = $('input[name=pass0]').val();
        var pass1 = $('input[name=pass1]').val();
        var pass2 = $('input[name=pass2]').val();
        var url = $(this).attr('data-url');
        var data = $('#form2').serialize();
        $.get('checkPass', {pass0: pass0}, function (res) {
            if (res.status == 1) {
                layer.msg(res.info);
                return;
            }
            if (pass1 == '') {
                layer.msg('请填写新密码！');
                return;
            }
            if (pass2 == '') {
                layer.msg('请填写确认密码！');
                return;
            }
            if (pass1 != pass2) {
                layer.msg('确认密码与新密码不一致！');
                return;
            }

            $.ajax({
                url: url,
                data: data,
                type: 'post',
                success: function (res) {
                    console.log(res);
                    layer.msg(res.info);
                }
            })
        })
    })


}
